package cn.btks.zuulserver.config.swagger;

import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 言少钱
 * @date 2020年06月11日 17:35
 * @GitHub：
 * @参考资料：
 * @Description:
 */
@Component
@Primary
public class DocumentationConfig implements SwaggerResourcesProvider {

    @Override
    public List<SwaggerResource> get() {
        List resources = new ArrayList<>();
        resources.add(swaggerResource("网关认证系统", "/v2/api-docs", "2.0"));
        resources.add(swaggerResource("成果展示系统", "/result-integration-server/v2/api-docs", "2.0"));
        resources.add(swaggerResource("数据库管理系统", "/database-handle-server/v2/api-docs", "2.0"));
        resources.add(swaggerResource("后台管理系统", "/manage-server/v2/api-docs", "2.0"));
        return resources;
    }

    private SwaggerResource swaggerResource(String name, String location, String version) {
        SwaggerResource swaggerResource = new SwaggerResource();
        swaggerResource.setName(name);
        swaggerResource.setLocation(location);
        swaggerResource.setSwaggerVersion(version);
        return swaggerResource;
    }
}
